<?php
namespace app\models;

use Yii;
use app\models\PlanBill;

class Inventory
{
	public static function getProductidList($orderunit,$receivingunit,$orderdate,$orderdate_end,$deliverydate,$deliverydate_end)
	{
		$plannumQuery = PlanBill::getPlannumQuery($orderunit,$receivingunit,$orderdate,$orderdate_end,$deliverydate,$deliverydate_end);

		$query = new \yii\db\Query();

		$productidList = $query->select("PRODUCTID")
				  ->from("JXC_INVENTORY")
				  ->where(['PLANNUM' => $plannumQuery])
			      ->all();

		$result = array();

		foreach($productidList as $productid){
			$result[] = $productid['PRODUCTID'];
		}

		return implode(",",$result);
	}
}